#include <cstdio>
#include <vector>

/**
 * Luogu P1077 Placing Flowers
 */

int main() {
    // Input
    int nKinds, nPos;
    scanf("%d %d", &nKinds, &nPos);
    std::vector<int> limits(nKinds);
    for (int i = 0; i < nKinds; i++)
        scanf("%d", &limits[i]);
    
    // Solve by DP
    std::vector<int> buf(nPos + 1, 0);
    buf[0] = 1;
    for (auto l : limits) {
        for (int i = nPos; i > 0; i--) {
            int low = std::max(0, i - l);
            int total = 0;
            for (int j = i; j >= low; j--) {
                total += buf[j];
                if (total >= 1000000)
                    total %= 1000007;
            }
            buf[i] = total;
        }
    }
    printf("%d\n", buf[nPos]);

    return 0;
}